<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    //return $router->app->version();
    echo phpinfo();
//    echo '<div style="margin: 20% auto; width: 50%; text-align: center; color: #555; cursor: pointer;">欢迎来到仙福缘官方商城</div>';
});


//接口文档
$router->get('/doc', function () use ($router) {
    return redirect('/doc/index.html');
});


//后台接口
$router->group(['prefix'=>'api/admin', 'namespace'=>'Admin'], function () use ($router) {
    $router->post('login', 'IndexController@dologin'); //登录
    $router->post('login/log/index', 'IndexController@loginlog'); //登录日志
    $router->post('leftmenu', 'IndexController@leftMenu'); //左侧菜单
    $router->post('tongji', 'IndexController@tongji'); //首页统计
    $router->post('logs/index', 'IndexController@getLogIndex'); //后台错误日志
    //功能
    $router->post('action/index', 'IndexController@getActionIndex'); //功能列表
    $router->post('action/one', 'IndexController@getActionOne'); //功能一个
    $router->post('action/parent', 'IndexController@getParent'); //父级功能
    $router->post('action/update', 'IndexController@actionUpdate'); //保存
    //管理员
    $router->post('admin/index', 'AdminController@getIndex');
    $router->post('admin/one', 'AdminController@getOne');
    $router->post('admin/save', 'AdminController@save');
    $router->post('admin/pwd', 'AdminController@setPwd');
    //用户
    $router->post('user/index', 'UserController@getUserIndex');
    $router->post('user/trace/index', 'UserController@getTraceIndex'); //浏览历史
    $router->post('xieyi/one', 'UserController@xieyiOne'); //用户协议获取
    $router->post('xieyi/modify', 'UserController@setXieyi'); //用户协议获取
    $router->post('user/recharge/index', 'UserController@getRechargeIndex'); //用户充值记录
    //微信配置
    $router->post('wx/config/one', 'UserController@wxConfigOne');
    $router->post('wx/config/modify', 'UserController@wxConfigModify');
    //收货地址
    $router->post('user/address/index', 'UserController@getAddressIndex'); //用户地址
    $router->post('user/address/default', 'UserController@setAddressDefault'); //用户地址默认
    //会员等级
    $router->post('level/index', 'LevelController@getIndex');
    $router->post('level/one', 'LevelController@getOne');
    $router->post('level/modify', 'LevelController@modify');
    $router->post('level/del', 'LevelController@setDel');
    //会员劵
    $router->post('coupon/index', 'CouponController@getIndex');
    $router->post('coupon/tmp/index', 'CouponController@tmpIndex');
    $router->post('coupon/tmp/option', 'CouponController@tmpOption');
    $router->post('coupon/tmp/add', 'CouponController@tmpAdd');
    $router->post('coupon/tmp/del', 'CouponController@tmpDel');
    $router->post('coupon/switch/one', 'CouponController@getSwitch');
    $router->post('coupon/switch/modify', 'CouponController@setSwitch');
    //商品分类
    $router->post('goods/cate/index', 'GoodsCateController@getIndex');
    $router->post('goods/cate/option', 'GoodsCateController@getOption');
    $router->post('goods/cate/one', 'GoodsCateController@getOne');
    $router->post('goods/cate/save', 'GoodsCateController@save');
    $router->post('goods/cate/del', 'GoodsCateController@setDel');
    //商品
    $router->post('goods/index', 'GoodsController@getIndex');
    $router->post('goods/one', 'GoodsController@getOne');
    $router->post('goods/cateSel', 'GoodsController@getCateList');
    $router->post('goods/add', 'GoodsController@addOne');
    $router->post('goods/modify', 'GoodsController@modify');
    $router->post('goods/del', 'GoodsController@setDel');
    $router->post('goods/more/upload', 'GoodsController@moreUpload');
    $router->post('goods/more/del', 'GoodsController@moreDel');
    $router->post('goods/sku/add', 'GoodsController@skuAdd');
    $router->post('goods/sku/modify', 'GoodsController@skuModify');
    $router->post('goods/sku/del', 'GoodsController@skuDel');
    //关键词
    $router->post('goods/word/list', 'GoodsController@getWordList');
    //门店
    $router->post('shop/index', 'ShopController@getIndex');
    $router->post('shop/one', 'ShopController@getOne');
    $router->post('shop/modify', 'ShopController@modify');
    $router->post('shop/del', 'ShopController@setDel');
    $router->post('shop/addresstomap', 'ShopController@addressToMap');
    //品牌
    $router->post('brand/index', 'BrandController@getIndex');
    $router->post('brand/add', 'BrandController@add');
    $router->post('brand/one', 'BrandController@getOne');
    $router->post('brand/del', 'BrandController@setDel');
    //图片上传
    $router->post('image/upload', 'ImageController@upload');
    $router->post('image/list', 'ImageController@getList');
    $router->post('video/upload', 'ImageController@uploadVideo');
    //购物车
    $router->post('cart/index', 'IndexController@getCartIndex');
    //订单
    $router->post('order/index', 'OrderController@getIndex');
    $router->post('order/one', 'OrderController@getOne');
    $router->post('order/auth', 'OrderController@setAuth');
    $router->post('order/send', 'OrderController@send');
    //接口文档
    $router->post('doc/leftMenu', 'DocController@leftMenu');
    $router->post('doc/one', 'DocController@getOne');
    $router->post('doc/add', 'DocController@add');

    /**
     * 二期
     */
    //发现话题
    $router->post('find/index', 'FindController@getIndex');
    $router->post('find/auth', 'FindController@setAuth');
    $router->post('find/one', 'FindController@getOne');
    /**
     * 二期渠道端
     */
    $router->group(['prefix'=>'qudao', 'namespace'=>'Qudao'], function () use ($router) {
        require_once('qudao.php');
    });
});


//小程序接口
$router->group(['prefix'=>'api/xcx', 'namespace'=>'ApiXcx'], function () use ($router) {
    //微信授权
    $router->post('wx/info', 'WxAuthController@setWxInfo');
    $router->get('wx/token', 'WxAuthController@wxtoken');
    $router->get('wx/phone', 'WxAuthController@wxPhone');
    //首页
    $router->post('brand/index', 'IndexController@getBrandIndex'); //品牌列表
    $router->post('brand/one', 'IndexController@getBrandOne'); //品牌详情
    //用户
    $router->post('user/infobytoken', 'UserController@infoByToken');
    $router->post('coupon/addbynew', 'UserController@addCouponByNew'); //新人领取优惠劵
    $router->post('user/head/upload', 'UserController@headUpload'); //上传头像
    $router->post('user/nick/modify', 'UserController@setNick'); //昵称修改
    $router->post('user/level/list', 'UserController@getLevelList'); //等级列表
    //$router->post('user/recharge', 'UserController@recharge'); //充值
    $router->post('user/xieyi', 'UserController@xieyi'); //用户协议
    $router->post('user/team', 'UserController@getTeamList'); //团队
    $router->post('user/teamOrder', 'UserController@getTeamOrderList'); //团队订单
    $router->post('user/sign', 'UserController@sign'); //签到
    $router->post('user/pointsLog', 'UserController@getPointsLog'); //积分日志
    $router->post('recharge/list', 'UserController@getRechargeList'); //充值记录
    //商品
    $router->post('goods/cate/list', 'GoodsController@getCateList'); //分类列表
    $router->post('goods/list', 'GoodsController@getGoodsList'); //商品列表
    $router->post('goods/one', 'GoodsController@getGoodsOne'); //商品详情
    $router->post('goods/option', 'GoodsController@getOption'); //商品选项
    $router->post('keyword/list', 'GoodsController@getKeywordList'); //关键词列表
    $router->post('keyword/batch/del', 'GoodsController@keywordBatchDel'); //关键词清理
    $router->post('goods/sku/list', 'GoodsController@getSkuList'); //SKU列表
    //浏览历史
    $router->post('read/add', 'GoodsController@readAdd'); //浏览记录
    $router->post('read/list', 'GoodsController@getReadList'); //浏览历史
    //购物车
    $router->post('cart/list', 'CartController@getList');
    $router->post('cart/add', 'CartController@add');
    $router->post('cart/reduce', 'CartController@reduce'); //递减
    $router->post('cart/batch/del', 'CartController@batchDel'); //批量删除
    $router->post('cart/zhuanhuan', 'CartController@zhuanhuan'); //转换
    //会员劵
    $router->post('coupon/list', 'CouponController@getList');
    $router->post('coupon/apply', 'CouponController@apply');
    $router->post('coupon/one', 'CouponController@getOne');
    $router->post('coupon/option', 'CouponController@getOption');
    $router->post('coupon/new/list', 'CouponController@getNewUserList'); //新用户优惠劵列表
    $router->post('coupon/new/add', 'CouponController@addNewUser'); //新用户优惠劵领取
    $router->post('coupon/switch/one', 'CouponController@getSwitchOne');
    //收货地址
    $router->post('address/list', 'AddressController@getList');
    $router->post('address/one', 'AddressController@getOne');
    $router->post('address/option', 'AddressController@getOption');
    $router->post('address/add', 'AddressController@add');
    $router->post('address/modify', 'AddressController@modify');
    $router->post('address/del', 'AddressController@setDel');
    $router->post('address/default', 'AddressController@setDefault');
    $router->post('address/default/one', 'AddressController@getDefaultOne');
    $router->post('address/tocheck', 'AddressController@setChecked');

    //订单
    $router->post('order/list', 'OrderController@getList');
    $router->post('order/option', 'OrderController@getOption'); //下单前选项
    $router->post('order/add', 'OrderController@add'); //购物车下单
    $router->post('order/addbygid', 'OrderController@addByGid'); //直接下单
    $router->post('order/cancel', 'OrderController@cancel'); //取消
    $router->post('order/revoke', 'OrderController@revoke'); //撤回
    $router->post('order/again', 'OrderController@again'); //再来一单
    $router->post('order/one', 'OrderController@getOne'); //详情
    $router->post('order/orderOption', 'OrderController@orderOption'); //直接下单选项
    $router->post('order/receive', 'OrderController@receive'); //收货
    $router->post('order/pickup', 'OrderController@pickup'); //自提

    //收益及提现
    $router->post('income/list', 'IncomeController@getList'); //收益记录
    $router->post('income/orderList', 'IncomeController@getOrderList'); //收益订单记录
    $router->post('withdraw/list', 'WithdrawController@getList');//提现列表
    $router->post('withdraw/addInfo', 'WithdrawController@addInfo'); //新增账户
    $router->post('withdraw/add', 'WithdrawController@add'); //新增提现
    $router->post('withdraw/modifyInfo', 'WithdrawController@modifyInfo'); //修改账户
    $router->post('withdraw/getInfo', 'WithdrawController@getInfo'); //获取账户详情

    //测试微信支付
    $router->post('pay/wxorder', 'WxPayController@wxorder'); //统一订单
    $router->post('pay/notice', 'WxPayController@notice'); //微信通知
    $router->post('pay/balance', 'WxPayController@balance'); //余额支付
    $router->post('pay/refund', 'WxPayController@refund'); //退款
    $router->post('pay/notice2', 'WxPayController@refundNotice'); //微信通知
    //图片上传
    $router->post('image/Multiple', 'ImageController@uploadMultipleImages'); //多图上传
});


//渠道端小程序接口
$router->group(['prefix'=>'api/qd', 'namespace'=>'ApiQd'], function () use ($router) {
    //微信授权
    $router->post('wx/info', 'WxAuthController@setWxInfo');
    $router->get('wx/token', 'WxAuthController@wxtoken');
    $router->get('wx/phone', 'WxAuthController@wxPhone');
    //首页
    $router->post('brand/index', 'IndexController@getBrandIndex'); //品牌列表
    $router->post('brand/one', 'IndexController@getBrandOne'); //品牌详情
    //素材
    $router->post('material/index', 'MaterialController@getList'); //素材列表
    $router->post('material/one', 'MaterialController@getOne'); //素材详情

    //公共接口
    $router->post('config/all', 'CommonController@getAllConfig'); //获取所有配置
    $router->post('config/key', 'CommonController@getConfigByKey'); //获取单独配置
    //用户
    //$router->post('user/info/save', 'UserController@setWxInfo'); //保存微信信息
    $router->post('user/infobytoken', 'UserController@infoByToken');
    $router->post('coupon/addbynew', 'UserController@addCouponByNew'); //新人领取优惠劵
    $router->post('user/head/upload', 'UserController@headUpload'); //上传头像
    $router->post('user/nick/modify', 'UserController@setNick'); //昵称修改
    $router->post('user/level/list', 'UserController@getLevelList'); //等级列表
    //$router->post('user/recharge', 'UserController@recharge'); //充值
    $router->post('user/xieyi', 'UserController@xieyi'); //用户协议
    $router->post('user/team', 'UserController@getTeamList'); //团队
    $router->post('user/teamOrder', 'UserController@getTeamOrderList'); //团队订单
    $router->post('user/teamOrderCount', 'UserController@getTeamOrderCount'); //团队订单统计
    $router->post('recharge/list', 'UserController@getRechargeList'); //充值记录

    //商品
    $router->post('goods/cate/list', 'GoodsController@getCateList'); //分类列表
    $router->post('goods/list', 'GoodsController@getGoodsList'); //商品列表
    $router->post('goods/one', 'GoodsController@getGoodsOne'); //商品详情
    $router->post('goods/option', 'GoodsController@getOption'); //商品选项
    $router->post('keyword/list', 'GoodsController@getKeywordList'); //关键词列表
    $router->post('keyword/batch/del', 'GoodsController@keywordBatchDel'); //关键词清理
    $router->post('goods/sku/list', 'GoodsController@getSkuList'); //SKU列表
    //浏览历史
    $router->post('read/add', 'GoodsController@readAdd'); //浏览记录
    $router->post('read/list', 'GoodsController@getReadList'); //浏览历史
    //购物车
    $router->post('cart/list', 'CartController@getList');
    $router->post('cart/add', 'CartController@add');
    $router->post('cart/reduce', 'CartController@reduce'); //递减
    $router->post('cart/batch/del', 'CartController@batchDel'); //批量删除
    $router->post('cart/zhuanhuan', 'CartController@zhuanhuan'); //转换
    //收货地址
    $router->post('address/list', 'AddressController@getList');
    $router->post('address/one', 'AddressController@getOne');
    $router->post('address/option', 'AddressController@getOption');
    $router->post('address/add', 'AddressController@add');
    $router->post('address/modify', 'AddressController@modify');
    $router->post('address/del', 'AddressController@setDel');
    $router->post('address/default', 'AddressController@setDefault');
    $router->post('address/default/one', 'AddressController@getDefaultOne');
    $router->post('address/tocheck', 'AddressController@setChecked');
    //订单
    $router->post('order/list', 'OrderController@getList');
    $router->post('order/option', 'OrderController@getOption'); //下单前选项
    $router->post('order/add', 'OrderController@add'); //购物车下单
    $router->post('order/addbygid', 'OrderController@addByGid'); //直接下单
    $router->post('order/cancel', 'OrderController@cancel'); //取消
    $router->post('order/revoke', 'OrderController@revoke'); //撤回
    $router->post('order/again', 'OrderController@again'); //再来一单
    $router->post('order/one', 'OrderController@getOne'); //详情
    $router->post('order/orderOption', 'OrderController@orderOption'); //直接下单选项
    $router->post('order/receive', 'OrderController@receive'); //收货
    $router->post('order/pickup', 'OrderController@pickup'); //自提

    //收益及提现
    $router->post('income/list', 'IncomeController@getList'); //收益记录
    $router->post('withdraw/list', 'WithdrawController@getList');//提现列表
    $router->post('withdraw/addInfo', 'WithdrawController@addInfo'); //新增账户
    $router->post('withdraw/add', 'WithdrawController@add'); //新增提现
    $router->post('withdraw/modifyInfo', 'WithdrawController@modifyInfo'); //修改账户
    $router->post('withdraw/getInfo', 'WithdrawController@getInfo'); //获取账户详情

    //测试微信支付
//    $router->post('pay/test', 'WxPayController@sign');
//    $router->post('pay/recharge', 'WxPayController@recharge'); //充值支付
//    $router->post('pay/order', 'WxPayController@orderPay'); //订单支付
    $router->post('pay/wxorder', 'WxPayController@wxorder'); //统一订单
    $router->post('pay/notice', 'WxPayController@notice'); //微信通知
    $router->post('pay/balance', 'WxPayController@balance'); //余额支付
    $router->post('pay/refund', 'WxPayController@refund'); //退款
    $router->post('pay/notice2', 'WxPayController@refundNotice'); //微信通知
});